<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>xeokit Example</title>
    <link href="../css/pageStyle.css" rel="stylesheet"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js"></script>
    <style>
        #myNavCubeCanvas {
            position: absolute;
            width: 250px;
            height: 250px;
            bottom: 100px;
            left: 50px;
            z-index: 200000;
        }
    </style>
</head>
<body>
<input type="checkbox" id="info-button"/>
<label for="info-button" class="info-button"><i class="far fa-3x fa-question-circle"></i></label>
<canvas id="myCanvas"></canvas>
<canvas id="myNavCubeCanvas"></canvas>
<div class="slideout-sidebar">
    <h1>NavCubePlugin</h1>
    <h2>Configured to Align with True North</h2>
    <p>In this example we're configuring a NavCube with two
        options, isProjectNorth and projectNorthOffsetAngle, to align it with true North.</p>
    <p>This is just a random example of where true North is. Note that the rotation of the NavCube about the vertical World axis is
        -30 degrees offset from the orientation of the house model.</p>
    <h3>Components Used</h3>
    <ul>
        <li>
            <a href="../../docs/class/src/viewer/Viewer.js~Viewer.html"
               target="_other">Viewer</a>
        </li>
        <li>
            <a href="../../docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html"
               target="_other">XKTLoaderPlugin</a>
        </li>
        <li>
            <a href="../../docs/class/src/plugins/NavCubePlugin/NavCubePlugin.js~NavCubePlugin.html"
               target="_other">NavCubePlugin</a>
        </li>
    </ul>
    <h3>Resources</h3>
    <ul>
        <li>
            <a href="http://openifcmodel.cs.auckland.ac.nz/Model/Details/274"
               target="_other">Model source</a>
        </li>
    </ul>
</div>
</body>
<script type="module">

    import {Viewer, NavCubePlugin, XKTLoaderPlugin, LocaleService} from  "../../dist/xeokit-sdk.min.es.js";

    const viewer = new Viewer({
        canvasId: "myCanvas",
        localeService: new LocaleService({
            messages: {
                "en": {
                    "NavCube": {
                        "front": "South",
                        "back": "North",
                        "top": "Top",
                        "bottom": "Bottom",
                        "left": "West",
                        "right": "East"
                    }
                }
            },
            locale: "en"
        })
    });

    viewer.camera.eye = [-3.933, 2.855, 27.018];
    viewer.camera.look = [4.400, 3.724, 8.899];
    viewer.camera.up = [-0.018, 0.999, 0.039];

    const xktLoader = new XKTLoaderPlugin(viewer);

    new NavCubePlugin(viewer, {
        canvasId: "myNavCubeCanvas",

        isProjectNorth: true,
        projectNorthOffsetAngle: -30.0 // Example value

    });

    const sceneModel = xktLoader.load({
        id: "myModel",
        src: "../../assets/models/xkt/v10/glTF-Embedded/Duplex_A_20110505.glTFEmbedded.xkt", // Sets visual states of object in model
        edges: true
    });

    window.viewer = viewer;

</script>
</html>